--- a/Makefile
+++ b/Makefile
@@ -97,7 +97,7 @@ version.c: version.sh $(patsubst %.o,%.c,$(VERSION_OBJS)) nl80211.h iw.h Makefil
 
 nl80211-commands.inc: nl80211.h
 	@$(NQ) ' GEN ' $@
-	$(Q)sed 's%^\tNL80211_CMD_%%;t n;d;:n s%^\([^=]*\),.*%\t[NL80211_CMD_\1] = \"\L\1\",%;t;d' nl80211.h | grep -v "reserved" > $@
+	$(Q)gsed 's%^\tNL80211_CMD_%%;t n;d;:n s%^\([^=]*\),.*%\t[NL80211_CMD_\1] = \"\L\1\",%;t;d' nl80211.h | grep -v "reserved" > $@
 
 %.o: %.c iw.h nl80211.h nl80211-commands.inc
 	@$(NQ) ' CC  ' $@
